import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sainbainu/common/routes/routes.dart';
import 'package:sainbainu/common/services/user.dart';
import 'package:sainbainu/common/widgets/page_wrapper.dart';

class LoginWrapper extends StatelessWidget {
  final Widget child;
  const LoginWrapper({super.key, required this.child});

  @override
  Widget build(BuildContext context) {
    return Obx(
      () => PageWrapper(
        showLoadingPage: false,
        showResultPage: !UserService.to.isLogin.value,
        resultDesc: '立即登录，开启全新世界',
        resultBtn: true,
        resultBtnText: '一键登录',
        onResultBtnTap: () => Get.toNamed(AppRoutes.login),
        child: child,
      ),
    );
  }
}
